package whf.framework.service;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;

import whf.framework.log.Log;
import whf.framework.log.LogFactory;
import whf.framework.util.BeanFactory;

/**
 * Spring服务基类，用于自动注册spring服务
 * @author wanghaifeng
 * @create Nov 15, 2006 9:13:55 PM
 * 
 */
public class SpringService implements InitializingBean, BeanNameAware {
	private static Log log = LogFactory.getLog(SpringService.class);
	
	protected String serviceBeanName;

	/* (non-Javadoc)
	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
	 */
	public void afterPropertiesSet() throws Exception {
		log.debug(this.serviceBeanName+"'s properties setted!");
	}

	/* (non-Javadoc)
	 * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
	 */
	public void setBeanName(String beanName) {
		this.serviceBeanName = beanName;
		BeanFactory.registerBean(this.getClass().getName(), this.serviceBeanName);
	}

}
